<?php
if (!empty($dataByUser)) {
    $i = 0;
    echo '<div style="height: 355px;overflow: auto">';
    foreach ($dataByUser as $userDetail) {
        $trainer = Users::getFrontEndUser($userDetail->from_users_id);
        $trainerName = (!empty($trainer->first_name) ? $trainer->first_name : $trainer->user->username);

        $imagePath = $userDetail->from_users_id;
        if ($trainer->photo <> "") {
            $imgsrc = baseUrl() . '../../' . getUploadDir() . $imagePath . '/profile/minithumb/' . $trainer->photo;
        } else {
            $imgsrc = baseUrl() . '../../upload/default-mini.png';
        }
        ?>
        <div class="padding20px">
            <div> <?php if ($i == 0) { ?>
                    <div style="float: left;width:50%;"><p class="query-name"><?php echo $trainerName; ?>
                        </p>
                        <p class="subject-head"><span>Subject: </span><?php echo $userDetail->subject; ?></p>
                    </div>
                    <div style="float: left;width:50%;">
                        <div id="AjaxLoader_id" style="display:none;">&nbsp;<img src="<?php echo ThemePath(); ?>/img/fancybox_loading@2x.gif" align="absmiddle"></div></div>
                <?php } ?><div style="clear:both;"></div><div class="height1px dash-borB addmarginB20 rempaddingB"></div>

                <div class="commentBox">
                    <ol>
                        <li>
                            <div class="padding">
                                <div class="user-info borB">                 	
                                    <p><img class="user-img" src="<?php echo $imgsrc; ?>" /> <?php echo $trainerName; ?><span class="commentDateStamp"><?php echo date("D, d M Y", convert_datetime($userDetail->created)) ?></span></p>
                                </div>
                                <div class="comment">                                    	
                                    <p><?php echo $userDetail->query ?></p>
                                </div>
                            </div>
                        </li>

                    </ol>
                </div>
                <?php $i++;
            }
            ?>
                <input type="hidden" name="users_id" id="front_end_users_id" value="<?php echo $userDetail->from_users_id; ?>"
        </div></div>

    </div>


<?php }
?>
